#ifndef __APP_TOOL_HEADER__
#define __APP_TOOL_HEADER__


#include "peprotocol.h"
#include "atlstr.h"

#define TTC_REGKEY_AUTO_START_SECTION			"SOFTWARE\\Microsoft\\Windows CE Services\\AutoStartOnConnect"

BOOL SetRegAutoStart(CString &sPEPath);


BOOL IsAutoStart(CString &sPEPath);

int GetAPPName(TCHAR* szAPPName);

int GetCFGPath(TCHAR *szPath);

void ShowMsgOnTray(TCHAR *pszInfo);

void AddFileTimeSpan(FILETIME &ft,time_t timeSpan);
void GetNextDay(FILETIME &ft);
void GetMidnightTime(FILETIME &ft);
void GetLocalMidnightTime(FILETIME &ft);
long GetFileTimeIntervalBySeconds(FILETIME &ft1,FILETIME &ft2);
int PECompareFileTime(FILETIME &ft1,FILETIME &ft2);
void FormatTimeString(__int64 iTimeInSecs,TCHAR *tszTime);
void FmtTimeString(SYSTEMTIME &st,TCHAR *tszTime);

void CheckXmlString(TCHAR *str);

int InitLog();

void PEWriteLog2File(TCHAR *szLogInfo);

void PEWriteLog2FileA(char *szLogInfo);

int GetAppDataPath(TCHAR* szPath);

int GetAPPPathEx(TCHAR* szPath);

void SetAppInstance(HINSTANCE hInstance);

HINSTANCE GetAppInstance();

list<TCHAR*> SplitString(TCHAR *str,TCHAR szDiv);
void FreeStringList(list<TCHAR*> strlist);

#endif